Change patcher build from Meson/Ninja/virtualenv/Go to Bazel#86
Merged
Change patcher build from Meson/Ninja/virtualenv/Go to Bazel#86
Conversation
…cies Configure Bazel 8.6.0 with toolchains_chromium for hermetic C++ builds. Port ooz C++ libraries (libooz, bunutil, libpoe, libbun) and the extract binary to native Bazel cc_library/cc_binary targets. Use simde and libsodium from the Bazel Central Registry. ooz is fetched as an external dependency via git_override with a build_file overlay. libunistring (needed by utf.cpp in bunutil and libpoe) is not yet on BCR and is temporarily excluded.
Build a minimal subset of libunistring (u16_tolower, u16_to_u8, u8_to_u16) from source via archive_override, with a handwritten BUILD file covering 22 .c files plus a u16_normalize stub. Public headers are generated from .in.h templates via patch_cmds (sed substitution of @variable@ markers). A minimal config.h replaces the full autoconf-generated one. This completes the ooz C++ build — all targets now compile with no excluded files and no system library dependencies.
Replace the genrule .so copy hack with a proper cc_shared_library target for libooz. Use the @rules_cc//cc/runfiles library to locate liblibooz.so at runtime via Rlocation(), guarded behind BAZEL_BUILD so the meson build still works unchanged. Add extract_bazel_wrapper.sh as a drop-in replacement for the meson-built extract binary. It delegates to `bazel run --run_in_cwd` so that runfiles are set up and the working directory is preserved for genbuild.py/ninja. Clean up extract.cpp: use #else instead of fallback check
Add rules_go and gazelle to MODULE.bazel. Gazelle generates BUILD files for all Go packages under patcher/ (cmd/dat2jsonl, cmd/poepatcher, dat/, dat/schema, dat/types, poepatcher/). Go test (dat/types) passes under bazel test. Add install-bazel.sh as a drop-in replacement for install.sh that builds Go and C++ via Bazel and places binaries where main.sh expects them. Verified: install-bazel.sh + main.sh produces identical output.
Extract the non-hermetic game data fetch logic from genbuild.py into fetch.py, exposed as a py_binary target. It runs poepatcher to download game files and extract in discovery mode to resolve bundle paths. install-bazel.sh now calls bazel run //patcher:fetch at the end.
The fetch logic (poepatcher + extract discovery) is now handled by bazel run //patcher:fetch. genbuild.py only generates build.ninja. The stamp file now depends on the bundle index file to detect changes.
Port the full patcher pipeline (extract → dat2jsonl → datrelease/ statparse/charversion/fingerprint) to Bazel genrules. Game data is wired in via @gamedata repo with --override_repository. A default empty repo is provided via local_path_override; the actual data is supplied at build time: bazel build //patcher/pipeline:fingerprint \ --override_repository=gamedata+=$PWD/patcher/Content.ggpk.d/latest All 6 release files are identical to the ninja-produced baseline. Also: replace asserts with proper error handling in extract.cpp, add -DIN_LIBUNISTRING to fix inline redefinition under -O2, and set --host_compilation_mode=dbg in .bazelrc to work around ooz UB.
Add pkg_tar target that packages all release files. Update main.sh to build the pipeline via Bazel and extract the tarball directly into web/nebuloch/data/, replacing the genbuild.py + ninja + release.sh flow.
fetch.sh now just downloads schema.min.json and runs bazel run //patcher:fetch. The old install.sh (meson/go build) is removed — Bazel handles all builds.
Extract patcher_extract() and patcher_dat2jsonl() macros into defs.bzl. The BUILD file is now ~100 lines instead of ~210, with the table list and language iteration defined once.
…ython3 Convert datrelease, statparse, charversion, fingerprint to py_binary targets with proper deps. Refactor datrelease.py to accept --input-dir and --output-dir args (removes symlink hack in genrule). Add a stub tqdm module so statparse works without the pip package.
Delete meson.build, genbuild.py, shell.nix, extract_bazel_wrapper.sh. Remove ooz submodule and .gitmodules. Remove #ifdef BAZEL_BUILD from extract.cpp — only the Bazel/runfiles code path remains. Clean up .gitignore.
e4e021d to
1d3505e
Compare
README: document fetch.sh + main.sh + release.sh workflow. CI: use setup-bazel action, run bazel test and the patcher pipeline. Dockerfile: replace meson/go/ninja with Bazel via bazelisk. Update READMEs for Bazel workflow
Add empty stub files and mark all @gamedata targets with target_compatible_with = @platforms//:incompatible in the stub repo. Pipeline targets are cleanly skipped without --override_repository. Add platforms dep to MODULE.bazel.
1d3505e to
8181746
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.